package com.yang.auth.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yang.auth.model.entity.User;
import com.yang.auth.model.mapper.UserMapper;
import org.springframework.stereotype.Component;

/**
 * 对mybatis-plus的再一次封装，起mapper作用
 */
@Component
public class UserDao extends ServiceImpl<UserMapper, User> {

    /**
     * 根据手机号查询用户
     * @param phone
     * @return
     */
    public User selectByPhone(String phone) {
        return getOne(new LambdaQueryWrapper<User>().eq(User::getPhone, phone));
    }

}
